import { useState } from 'react';
import {useRef} from 'react'
function App(){
    // 保存数据 缓存数据
    let num = useRef(0);
    let [msg,setMsg] = useState(100)
    console.log(num.current)
    return (
        <div>
            <h1>useRef保存数据----{num.current}----{msg}</h1>
            <button onClick={()=>{
                num.current++;
                setMsg(msg+100)
            }}>num++</button>
        </div>
    )
}


export default App;